package net.tensor.tensorprovider.config;

import org.apache.rocketmq.common.message.Message;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.stereotype.Service;

/**
 * @author Q
 */
@Service
public class ProviderService {
    @Autowired
    private MessageChannel output;

    public boolean send(String message) {
        Message message1 =new Message();
        message1.setTopic("tensor-core");
        message1.setTags("tensor-core-tag");
        message1.setKeys("tensor-core-key");
        message1.setBody(message.getBytes());
        return output.send(MessageBuilder.withPayload(message1).build());
    }
}
